<!DOCTYPE html>
<html lang="en">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div class="container-fluid">
    <div class="row-fluid">
        <div th:insert="/admin/common/side::side" ></div>
        <!-- content -->
        <div class="block">
            <div class="block-content collapse in">
                <div class="span12">
                    <form class="form-horizontal" method="post" th:action="@{/admin/resource/update}" enctype="multipart/form-data">
                        <fieldset>
                            <legend>用户修改</legend>

                            <div class="control-group" th:if="${resource != null}">
                                <label class="control-label">资源id</label>
                                <div class="controls">
                                    <input readonly="readonly" required type="text" class="input-xlarge datepicker" id="id" name="id" th:value="${resource!=null?resource.id:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >资源名称</label>
                                <div class="controls">
                                    <input required type="text" class="input-xlarge datepicker" id="username" name="name" th:value="${resource!=null?resource.name:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >资源关键字</label>
                                <div class="controls">
                                    <input required type="text" class="input-xlarge datepicker" id="keyword" name="keyword" th:value="${resource!=null?resource.keyword:''}">
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" >图片上传</label>
                                <div class="controls">
                                    <input class="input-file uniform_on" multiple required name="files" type="file">
                                </div>
                            </div>

                            <div class="control-group" th:if="${resource != null}">
                                <div class="controls" th:each="url:${resource.urls}">
                                    <img th:src="${url}" style="width: 50%;height: 50%"/>
                                </div>
                            </div>

                            <div class="control-group success">
                                <label class="control-label" >图片类别</label>
                                <div class="controls">
                                    <select name="type" id="carId" class="form-control1" th:value="${resource != null ? resource.type:''}">
                                        <option th:selected="${resource != null ? resource.type == type.id: ''}" th:each="type:${types}" th:value="${type.id}" th:text="${type.name}"></option>
                                    </select>
                                </div>
                            </div>


                            <div class="form-actions">
                                <button type="submit" class="btn btn-primary"  >[[ ${resource!=null?'更新':'新增'} ]]</button>
                            </div>
                        </fieldset>
                    </form>

                </div>
            </div>
        </div>
        <!-- content -->
    </div>
</div>
<!--  main  -->

</body>
<div th:insert="/admin/common/footer::js" ></div>

</html>